package com.example.anno;

import com.example.validation.StateValidation;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.FIELD;

/**
 * 自定义状态参数校验注解
 * @author weijingchen
 * @DateTime 2025-09-26
 */
@Documented
@Target(FIELD)// 注解作用在字段上
@Retention(RetentionPolicy.RUNTIME)// 注解在运行时保留
@Constraint(validatedBy = StateValidation.class)
public @interface State {
    // 提供校验失败后的提示信息
    String message() default "state参数只能是已发布或者草稿";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
